using System.Configuration;

namespace IFXplus.SmartStorage.Settings
{
    [ConfigurationCollection(typeof(IStorageProviderSettings))]
    public class StorageProviderSettingsCollection<T> : ConfigurationElementCollection where T : ConfigurationElement, IStorageProviderSettings, new()
    {
        protected override ConfigurationElement CreateNewElement()
        {
            return new T();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((T)element).Id;
        }

        public new T this[string id]
        {
            get { return (T)BaseGet(id); }
        }

        public T this[int index]
        {
            get { return (T)BaseGet(index); }
        }

    }
}
